﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GoalManagement_Scoreboard.aspx.cs" Inherits="PMP.Goals.GoalManagement_Scoreboard" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Scoreboard</title>
    <style type="text/css">
        .style1
        {
            width: 33%;
        }
        .style2
        {
            width: 67px;
            text-align: right;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table class="style1">
            <tr>
                <td class="style2">
                    Assignee:</td>
                <td>
                    <asp:TextBox ID="txtAuthor" runat="server" Height="25px" ReadOnly="True" 
                        Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Type:</td>
                <td>
                    <asp:DropDownList ID="ddlTypes" runat="server" Height="25px" Width="200px">
                        <asp:ListItem>REQUIREMENTS</asp:ListItem>
                        <asp:ListItem>DESIGN</asp:ListItem>
                        <asp:ListItem>DEMO</asp:ListItem>
                        <asp:ListItem>CODE</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Score:</td>
                <td>
                    <asp:DropDownList ID="ddlScores" runat="server" Height="25px" Width="200px">
                        <asp:ListItem>5</asp:ListItem>
                        <asp:ListItem>4</asp:ListItem>
                        <asp:ListItem>3</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                        <asp:ListItem>1</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Notes:</td>
                <td>
                    <asp:TextBox ID="txtNotes" runat="server" Height="186px" TextMode="MultiLine" 
                        Width="400px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Add" />
                </td>
                <td>
                    <asp:Button ID="btnCancel" runat="server" onclick="btnCancel_Click" 
                        Text="Cancel" />
                </td>
            </tr>
        </table>
    
    </div>
    <asp:TextBox ID="txtGoalID" runat="server" Visible="False"></asp:TextBox>
    <br />
    Scoreboard:<asp:GridView ID="grvScoreboard" runat="server" AutoGenerateColumns="False" 
        CellPadding="4" DataSourceID="SqlDataSourceScoreboard" ForeColor="#333333" 
        OnRowEditing="grvScoreboard_OnRowEditing" 
        OnRowCancelingEdit="grvScoreboard_OnRowCancelingEdit" 
        OnRowDeleted="grvScoreboard_OnRowDeleted" 
        OnRowUpdated="grvScoreboard_OnRowUpdated" DataKeyNames="id">
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="id" HeaderText="id" SortExpression="id" 
                InsertVisible="False" ReadOnly="True" />
            <asp:BoundField DataField="type" HeaderText="type" SortExpression="type" />
            <asp:BoundField DataField="assignee" HeaderText="assignee" 
                SortExpression="assignee" />
            <asp:BoundField DataField="score" HeaderText="score" 
                SortExpression="score" />
            <asp:BoundField DataField="reviewer" HeaderText="reviewer" 
                SortExpression="reviewer" />
            <asp:BoundField DataField="notes" HeaderText="notes" 
                SortExpression="notes" />
            <asp:BoundField DataField="goal_id" HeaderText="goal_id" 
                SortExpression="goal_id" />
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceScoreboard" runat="server" 
        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
        DeleteCommand="DELETE FROM [Scoreboard] WHERE [id] = ?" 
        InsertCommand="INSERT INTO [Scoreboard] ([id], [type], [assignee], [score], [reviewer], [notes], [goal_id]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [Scoreboard] ORDER BY [type]" 
        
        UpdateCommand="UPDATE [Scoreboard] SET [type] = ?, [assignee] = ?, [score] = ?, [reviewer] = ?, [notes] = ?, [goal_id] = ? WHERE [id] = ?">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="type" Type="String" />
            <asp:Parameter Name="assignee" Type="String" />
            <asp:Parameter Name="score" Type="Int32" />
            <asp:Parameter Name="reviewer" Type="String" />
            <asp:Parameter Name="notes" Type="String" />
            <asp:Parameter Name="goal_id" Type="Int32" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="id" Type="Int32" />
            <asp:Parameter Name="type" Type="String" />
            <asp:Parameter Name="assignee" Type="String" />
            <asp:Parameter Name="score" Type="Int32" />
            <asp:Parameter Name="reviewer" Type="String" />
            <asp:Parameter Name="notes" Type="String" />
            <asp:Parameter Name="goal_id" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
